package com.sali.design_pattern.b_abstract_factory_pattern.lesson_03;

import com.sali.design_pattern.b_abstract_factory_pattern.lesson_03.factory.FurnitureFactory;
import com.sali.design_pattern.b_abstract_factory_pattern.lesson_03.factory.impl.ClassicalFurnitureFactory;
import com.sali.design_pattern.b_abstract_factory_pattern.lesson_03.factory.impl.ModernFurnitureFactory;
import com.sali.design_pattern.b_abstract_factory_pattern.lesson_03.product.Chair;
import com.sali.design_pattern.b_abstract_factory_pattern.lesson_03.product.Sofa;

public class Lesson03Starter {

    public static void main(String[] args) {
        // 读取订单数量
        int N = 1;
        // 处理每个订单
        for (int i = 0; i < N; i++) {
            // 读取家具类型
            String furnitureType = "modern";
            // 创建相应⻛格的家居装饰品⼯⼚
            FurnitureFactory factory;
            if (furnitureType.equals("modern")) {
                factory = new ModernFurnitureFactory();
            } else if (furnitureType.equals("classical")) {
                factory = new ClassicalFurnitureFactory();
            } else {
                throw new RuntimeException("家具类型识别异常");
            }
            // 根据⼯⼚⽣产椅⼦和沙发
            Chair chair = factory.createChair();
            Sofa sofa = factory.createSofa();
            // 输出家具信息
            chair.showInfo();
            sofa.displayInfo();
        }
    }

}
